package com.chhuang.uresource.po;

import java.io.Serializable;
import java.util.Date;
import com.chhuang.core.model.AbstractPersistentModel;
import com.chhuang.core.validation.ValidGroupSave;
import com.chhuang.core.validation.ValidGroupUpdate;
import com.sun.xml.bind.CycleRecoverable;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.annotation.JSONField;

/**
* ULabel Model
* @author ChHuang
* @date Wed Mar 14 14:38:59 CST 2018
*/
public class ULabel extends AbstractPersistentModel implements CycleRecoverable{
	private static final long serialVersionUID = -699547110843386375L;
	@NotNull(message="{ULabel.labelId.NotNull}",groups={ValidGroupUpdate.class})
	@Size(max=32,message="{ULabel.labelId.Size}",groups={ValidGroupSave.class})
	private String labelId;
	public String getLabelId(){
		return labelId;
	}
	public void setLabelId(String labelId){
		this.labelId=labelId;
	}
	@Size(max=255,message="{ULabel.label.Size}",groups={ValidGroupSave.class})
	private String label;
	public String getLabel(){
		return label;
	}
	public void setLabel(String label){
		this.label=label;
	}
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	public Date getCreateTime(){
		return createTime;
	}
	public void setCreateTime(Date createTime){
		this.createTime=createTime;
	}
	@Override
	public Serializable getId() {
		return getLabelId();
	}
	@Override
	public void setId(Serializable id) {
		setLabelId((String)id);
	}
	@Override
	public Object onCycleDetected(Context arg0) {
		ULabel temp=new ULabel();
		temp.setLabelId(labelId);
		return temp;
	}
	@Override
	public String toString() {
		return "ULabel [labelId="+labelId+",label="+label+",createTime="+createTime+"]";
	}
}